﻿@page "/"
@inherits AppComponentBase
@attribute [PageInfo(Icon = "home", Id = "Home", Pin = true, Sort = 0, Title = "主页")]

<JsTimer Interval="1000" Callback="Update"></JsTimer>
@if (homeType == null)
{
    <MCard>
        <h2>
            会话创建时间<FontIcon IconName="fa fa-comment"></FontIcon>: @(User?.UserInfo?.CreatedTime.ToString("yyyy-MM-dd HH:mm:ss"))
        </h2>
    </MCard>
    <MCard>
        <h2>
            会话持续时间<FontIcon IconName="fa fa-comment"></FontIcon>: @((DateTime.Now - User?.UserInfo?.CreatedTime)?.ToString("dd\\-hh\\:mm\\:ss"))
        </h2>
    </MCard>
}
else
{
    <DynamicComponent Type="homeType"></DynamicComponent>
}

@* <MCard> *@
@*     <div style="display:flex;gap:5px;flex-wrap:wrap;"> *@
@*         @for (int i = 0; i < Project.Web.Shared.Utils.FontAwesomeHelper.AllIcons().Length; i++) *@
@*         { *@
@*             var index = i; *@
@*             var icon = Project.Web.Shared.Utils.FontAwesomeHelper.AllIcons()[i]; *@
@*             <span> *@
@*                 <span>@(index + 1)</span> *@
@*                 <FontIcon Icon="@($"fa fa-{icon}")"></FontIcon> *@
@*             </span> *@
@*         } *@
@*     </div> *@
@* </MCard> *@

@CurrentRenderMode()
@* @{ *@
@*     var icons = Assets.Where(a => a.Url.EndsWith(".svg")).ToList(); *@
@* } *@
@* @foreach (var i in icons) *@
@* { *@
@*     <p>@i.Url, @i.Properties.FirstOrDefault()?.Value</p> *@
@* } *@